import datetime

"""
Channel order used in the system.
"""
"""
Sentinel 2 Channel order. used in Decloud Raster generation and data preprocessing.
"""
S2_CHANNEL_LIST = [
    "s2_B02",
    "s2_B03",
    "s2_B04",
    "s2_B05",
    "s2_B06",
    "s2_B07",
    "s2_B08",
    "s2_B8A",
    "s2_B11",
    "s2_B12",
]

S2_CHANNEL_ORDER = dict()
for idx, key in enumerate(S2_CHANNEL_LIST):
    S2_CHANNEL_ORDER[key] = idx

S2_CHANNEL_MAP = {key: key.split("_")[1] for key in S2_CHANNEL_ORDER.keys()}

"""
Sentinel 1 Channel order. Used in preprocessing and data preprocessing.
"""

S1_CHANNEL_LIST = [
    "s1_vv",
    "s1_vh",
]

S1_CHANNEL_ORDER = dict()
for idx, key in enumerate(S1_CHANNEL_LIST):
    S1_CHANNEL_ORDER[key] = idx

S1_CHANNEL_MAP = {key: key.split("_")[1] for key in S1_CHANNEL_ORDER.keys()}

"""
asset names, currently for sentinel 2 only
"""

ASSET_NAMES = [name.split("_")[1] for name in S2_CHANNEL_LIST]
S2_ORI_RANGE = (0, 10000)
S2_TGT_RANGE = (0, 1)

S2_STATS_MEAN = [
    0.09789359828904251,
    0.120864720497956,
    0.1316181597442865,
    0.16367440231516187,
    0.22218199347328732,
    0.2459265847926639,
    0.2565321528472022,
    0.261861264377202,
    0.21967710445585062,
    0.16592834514188215,
]
VI_STATS_MEAN = {"ndvi": 0.36865, "evi": 0.24, "lswi": 0.09, "ccci": 0.4}
S2_STATS_STD = [
    0.12004702671883392,
    0.11775597966169965,
    0.12855879824463598,
    0.12451287284262101,
    0.12090801010947236,
    0.12520744793291244,
    0.13171849547751327,
    0.12604806480514452,
    0.10608431491485246,
    0.09673390686991087,
]
VI_STATS_STD = {"ndvi": 0.4606, "evi": 0.2892, "lswi": 0.2798, "ccci": 0.37}

# SCL_INVALID_MASK = [1, 0, 3, 8, 9, 10]
SCL_INVALID_MASK = [0, 8, 9, 10]

SUPPORTED_TEMPORAL_OFFSETS = {
    "origin": [
        datetime.datetime(2021, 1, 1) - datetime.datetime(2021, 1, 1),
        datetime.datetime(2022, 1, 1) - datetime.datetime(2021, 1, 1),
    ],
    "shifted": [
        datetime.datetime(2021, 8, 1) - datetime.datetime(2021, 1, 1),
        datetime.datetime(2022, 8, 1) - datetime.datetime(2021, 1, 1),
    ],
}
